/**
 * 
 */

package com.wutianyi.thrift.example.noblocking;

import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;

import com.wutianyi.thrift.tutorial.Calculator;

/**
 * @author wutianyi
 * 
 */
public class Client {

	public static void main(String[] args) throws TTransportException {

		TTransport transport = new TSocket("localhost", 9090);
		transport = new TFramedTransport(transport);
		TBinaryProtocol protocol = new TBinaryProtocol(transport);
		Calculator.Client client = new Calculator.Client(protocol);
		transport.open();
		try {
			int i = client.add(1, 1);
			System.out.println(i);
			transport.close();
		}catch(TException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
